<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>demo</title>
    <style>
      .box {
        width: 200px;
        height: 200px;
        background: lightcoral;
      }
      .box2 {
        width: 200px;
        height: 200px;
        background: lightsalmon;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <h1>1.显示或隐藏 ： v-show</h1>
      <input type="button" value="下拉菜单" @click="show" />
      <div class="box" v-show="isshow"></div>

      <h1>2.创建或删除 ： v-if</h1>
      <input type="button" value="下拉菜单" @click="isshow2=!isshow2" />
      <div class="box" v-if="isshow2"></div>
      <!-- <div class="box2" v-else></div> -->
    </div>
  </body>
  <script src="../node_modules/vue/dist/vue.js"></script>
  <script>
    new Vue({
      el: "#app",
      data: {
        isshow: false,
        isshow2: false,
      },
      methods: {
        show() {
          this.isshow = !this.isshow;
        },
      },
    });
  </script>
</html>
